import React, { useState, useEffect } from 'react';
import { useDispatch, useSelector } from 'react-redux';
import {
  selectUser,
  selectApi_permission,
  selectRouter_permission,
  loginIn,
} from './redux/Slice/userSlice';
import './App.css';
import { useNavigate, Outlet, BrowserRouter } from 'react-router-dom';
import Loading from './components/Loading';
import AppRouter from './AppRouter';
import { UserInit } from './utils/hooks';
import { ConfigProvider } from 'antd';
import zhCN from 'antd/lib/locale/zh_CN';
const App = () => {
  let user = useSelector(selectUser);
  let api_permission = useSelector(selectApi_permission);
  let router_permission = useSelector(selectRouter_permission);
  const { isLoading } = UserInit();
  return (
    <BrowserRouter>
      <ConfigProvider locale={zhCN}>
        <div className="App">{isLoading ? <Loading /> : <AppRouter />}</div>
      </ConfigProvider>
    </BrowserRouter>
  );
};

export default App;
